package cn.iocoder.yudao.module.xkfz.controller.admin.excel;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.xkfz.domain.entity.clinicalHealthCare.ElementData;
import cn.iocoder.yudao.module.xkfz.domain.entity.talentEchelon.TalentEchelon;
import cn.iocoder.yudao.module.xkfz.domain.excel.entity.GuidelinesAndConsensus;
import cn.iocoder.yudao.module.xkfz.domain.po.clinicalHealthCare.ElementDataPo;
import cn.iocoder.yudao.module.xkfz.service.basic.IndicatorClassCalculationService;
import cn.iocoder.yudao.module.xkfz.service.talentEchelon.TalentEchelonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 人才梯队建设
 */
@RestController
@RequestMapping("talentEchelon")
public class TalentEchelonController {
    @Autowired
    private TalentEchelonService talentEchelonService;


    /**
     * 导入引用
     * @param file
     * @param year
     * @return
     * @throws IOException
     */
    @PostMapping("importTalentEchelon")
    public CommonResult<Boolean> importGuidelinesAndConsensus(@RequestParam("file") MultipartFile file,
                                                              @RequestParam("year")  String year,
                                                              @RequestParam("indicatorName")  String indicatorName
                                                              ) throws IOException {
        List<TalentEchelon> list = ExcelUtils.read(file, TalentEchelon.class);

        return success(talentEchelonService.importIntroductionOfCulture(list, year,indicatorName));
    }


}
